<template>
  <template v-if="item.children && item.children.length > 0">
    <el-sub-menu :index="item.id">
      <template #title>
        <span>{{ item.name }}</span>
      </template>
      <menuItem
        v-for="(subItem, index) in item.children"
        :key="index"
        :item="subItem"
      ></menuItem>
    </el-sub-menu>
  </template>
  <template v-else>
    <el-menu-item :key="item.id" :index="`/home${item.component}`">
      <template #title>
        <span>{{ item.name }}</span>
      </template>
    </el-menu-item>
  </template>
</template>

<script lang="ts" setup>
defineProps<{ item: any }>();
</script>

<style lang="scss" scoped></style>
